<script setup lang="ts">
import {ref} from "vue";

const time = ref(10)

//事件触发
const $emits = defineEmits(["showSend"]);

//倒计时
const interval = setInterval(() => {
  time.value--
  if (time.value === 0) {
    clearInterval(interval)
    //发送事件，展示send组件
    $emits("showSend", false)
  }
}, 1000);


</script>

<template>
  <div class="count-down">
    <el-button>{{ time }}秒</el-button>
  </div>
</template>

<style scoped lang="less">

</style>
